<template>
  <div class="home">
    <div class="box">
      <top @addShop="addShop"></top>
      <List :shopList="shopList" @delShop="delShop"></List>
    </div>
  </div>
</template>

<script>
import Top from "@/components/Top.vue";
import List from "@/components/List.vue";

export default {
  name: "HomeView",
  data() {
    return {
      name: "",
      price: "",
      shopList: []
    };
  },
  methods: {
    // 添加
    addShop(obj) {
      let { name, price } = obj;
      this.name = name;
      this.price = price;
      this.shopList.push({
        name: this.name,
        price: this.price
      });
      
    },
  },
  components: {
    Top,
    List
  }
};
</script>
<style lang="scss" scoped>
</style>

